Ti.include('animation.js');
Ti.include('share.js');
Ti.include('t.js');

	
var tmpWin = function(pTitle, pType){
	var tmp = Titanium.UI.createWindow({
		top: 0,
		width: 320,
		height: 410,
		backgroundImage: "media/images/bglist.png",
	})
	
	var barTop = Titanium.UI.createView({
		top: 0,
		width: 320,
		height: 44,
		backgroundImage: "media/images/bar-top.png",
	});
	var title = Ti.UI.createImageView({
		image: 'media/home/images/' + pTitle + ".png",
		left: 0,
		top: 0,
		width: 320,
		height: 44,
		zIndex: 99
	})
	barTop.add(title);
	tmp.add(barTop);
	
	var cover = Ti.UI.createImageView({
		image: 'media/images/cover.png',
		left: 0,
		top: 44,
		width: 320,
		height: 33,
		zIndex: 9999
	})
	tmp.add(cover);
	
	
	var btnBack = Ti.UI.createButton({
		image: "media/nav/btn_back.png",
		top: 10,
		left: 15,
		width: 54,
		height: 25
	})			
	btnBack.addEventListener('click', function(e){
		animateIt(tmp, 'LOut');
	})
	tmp.add(btnBack);
	animateIt(tmp, 'LIn');
	

	if(pType == 'list'){
		dataSource(pTitle, dView);
		tmp.add(dView);
	}
	
	if(pTitle == 'weibo'){
		var btnFollow = Ti.UI.createButton({
			image: "media/nav/btn_follow.png",
			top: 10,
			width: 54,
			height: 25,
			right: 15,
			
		})	
		btnFollow.addEventListener('click', function(e){
			var shareArray = ['', '', '', 1963017723];
			var hs = new hShare();
			hs.sinaShare(shareArray);
			
		})
		tmp.add(btnFollow);
	}


	return tmp;
}

var dView = Titanium.UI.createTableView({
	width: 320,
	left: 0,
	top: 50,
	zIndex: 999,
	height: 370,
	backgroundColor: "transparent",
	separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
	id: 'dView'
	
});

/**
dView.addEventListener('scroll',function(e)
{
	var offset = e.contentOffset.y;
	Ti.API.debug(offset);
	
	if (offset <= -45.0)
	{
		Ti.API.debug("Release to refresh...");
	}
	else if (offset > -45.0 && offset < 0)
	{
		Ti.API.debug("Pull down to refresh...");
	}
	
});


dView.addEventListener('scrollEnd',function(e)
{
	if (pulling && !reloading && e.contentOffset.y <= -65.0)
	{
		reloading = true;
		pulling = false;
		arrow.hide();
		actInd.show();
		statusLabel.text = "Reloading...";
		tableView.setContentInsets({top:60},{animated:true});
		arrow.transform=Ti.UI.create2DMatrix();
		beginReloading();
	}
});
*/
